package com.algo.url;

public class Main {

        public static void main(String[] args) throws NumberFormatException, InterruptedException {
                    
                    //first scratch
                    new TitleCrawler(args[0], args[1]+"_1", args[2]+"_1").multiThreadsGetTitle(Integer.parseInt(args[3]), Integer.parseInt(args[4]));
                                    
                    //second scratch
                                    
                    if(args.length >= 6){
                            boolean reScratch = Boolean.parseBoolean(args[5]);
                            if(reScratch == false) return;
                            TitleCrawler.setReScratch(reScratch);
                            TitleCrawler.setSocketTimeOutMillis(Integer.parseInt(args[6]));
                            if(args.length >= 8)
                                  TitleCrawler.setScratchInterval(Long.parseLong(args[7]));
                            int threadsNum = 1;
                            if(args.length >= 9)
                                threadsNum = Integer.parseInt(args[8]);
                            new TitleCrawler(args[2]+"_1", args[1]+"_2", args[2]+"_2").multiThreadsGetTitle(threadsNum, Integer.parseInt(args[4]));
                    }                
        }

}
